/**
 * API 状态码常量定义模块
 * @author HalRui
 * @version 1.0.0
 * @description 统一定义API返回的状态码和消息，包括成功状态、用户错误、邮箱错误、服务器错误等
 * @date 2025年9月27日
 */

const STATUS_CODES = {
  // 成功状态
  SUCCESS: { code: 0, message: "操作成功" },
  
  // 用户相关错误 (1000x系列)
  REGISTER_FAILED: { code: 10001, message: "注册失败" },
  EMAIL_OR_PASSWORD_ERROR: { code: 10002, message: "邮箱或密码错误" },
  CAPTCHA_ERROR: { code: 10003, message: "验证码输入有误" },
  LOGIN_EXPIRED: { code: 10004, message: "登录过期,请重新登录" },
  SERVER_LOGIN_ERROR: { code: 10005, message: "服务器错误,登录失败" },
  
  // 邮箱相关错误 (2000x系列)
  EMAIL_FORMAT_INVALID: { code: 20001, message: "邮箱格式不正确,请及时更正" },
  EMAIL_ALREADY_USED: { code: 20002, message: "该邮箱已被使用" },
  EMAIL_CODE_SEND_FAILED: { code: 20003, message: "邮件验证码发送失败,请稍后再试" },
  EMAIL_CODE_INVALID: { code: 20004, message: "邮箱验证码不正确" },
  PASSWORD_NOT_MATCH: { code: 20005, message: "两次输入的密码不一致" },
  PASSWORD_FORMAT_INVALID: { code: 20006, message: "密码格式不正确，密码长度应为8-20位，包含字母和数字" },
  
  // 用户名相关错误 (5000x系列)
  USERNAME_ALREADY_USED: { code: 50001, message: "该用户名已被使用" },
  USERNAME_FORMAT_INVALID: { code: 50002, message: "用户名格式不正确,支持中英文、数字、下划线,长度2-20位" },
  
  // 手机号相关错误 (6000x系列)
  PHONE_ALREADY_USED: { code: 60001, message: "该手机号已被使用" },
  PHONE_FORMAT_INVALID: { code: 60002, message: "手机号格式不正确" },
  
  // 服务器错误 (3000x系列)
  SERVER_ERROR: { code: 30001, message: "服务器错误" },
  CAPTCHA_SAVE_FAILED: { code: 30002, message: "验证码保存失败" },
  CAPTCHA_GENERATE_FAILED: { code: 30003, message: "验证码生成失败" },
  AUTO_LOGIN_FAILED: { code: 30004, message: "自动登录失败" },
  USER_STATUS_FAILED: { code: 30005, message: "获取用户状态失败" },
  UPDATE_PROFILE_FAILED: { code: 30006, message: "更新用户资料失败" },
  GET_USER_INFO_FAILED: { code: 30007, message: "获取用户信息失败" },
  
  // 用户状态相关 (4000x系列)
  USER_NOT_FOUND: { code: 40001, message: "用户不存在" },
  
  // 请求参数相关 (8000x系列)
  PARAM_ERROR: { code: 80001, message: "参数错误" },
  NOT_FOUND: { code: 80002, message: "资源不存在" },
  FORBIDDEN: { code: 80003, message: "权限不足" },

  //上传相关的 (7000x系列)
  NO_VIDEO_UPLOADED : { code: 70001, message: "您没有上传任何视频" },
  UPLOAD_ERROR : {code: 70002 , message:"视频上传失败"},
  PULISH_ERROR : {code: 70003 , message:"视频发布失败"}
};

module.exports = STATUS_CODES;